<%@ page import="java.util.List" %>
<%@ page import="com.yuan.fruitweb.model.Fruit" %><%--
  Created by IntelliJ IDEA.
  User: 11640
  Date: 2020/11/20
  Time: 11:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html lang="zh">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <title>水果列表</title>
    <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">


</head>
<body>
<div class="container-fluid">
    <div class="row">
        <div class="col-md-12">
            <nav class="navbar navbar-expand-lg navbar-light bg-light">

                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="navbar-toggler-icon"></span>
                </button> <a class="navbar-brand" href="#">Brand</a>
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="navbar-nav">
                        <li class="nav-item active">
                            <a class="nav-link" href="#">显示所有水果信息<span class="sr-only">(current)</span></a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="toFruitAdd">添加水果信息</a>
                        </li>
                    </ul>
                    <ul class="navbar-nav ml-md-auto">
                        <li class="nav-item active">
                            <a class="nav-link" href="#">水果下架<span class="sr-only">(current)</span></a>
                        </li>
                    </ul>
                </div>
            </nav>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <table class="table table-bordered table-hover">
                <thead>
                <tr>
                    <th>
                        #
                    </th>
                    <th>
                        名称
                    </th>
                    <th>
                        数量
                    </th>
                    <th>
                        价格
                    </th>
                    <th>
                        备注
                    </th>
                    <th>
                        操作
                    </th>
                </tr>
                </thead>
                <tbody>
                <%
                    List<Fruit> fruits= (List<Fruit>) request.getAttribute("fruits");
                    for(Fruit fruit:fruits){
                        out.println("<tr>");
                        out.println("<td>"+fruit.getId()+"</td>");
                        out.println("<td>"+fruit.getName()+"</td>");
                        out.println("<td>"+fruit.getCount()+"</td>");
                        out.println("<td>"+fruit.getPrice()+"</td>");
                        out.println("<td>"+fruit.getRemark()+"</td>");
                        out.println("<td><a href='fruitDel?id="+fruit.getId()+"'>删除</a>&nbsp;&nbsp;<a href='fruitEdit?id="+fruit.getId()+"'>编辑</a></td>");
                        out.println("</tr>");
                    }
                %>
                </tbody>
            </table>
            <h2 class="text-center">
                大锰咂
            </h2>
        </div>
    </div>
</div>


<script src="node_modules/jquery/dist/jquery.slim.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
